<form id="form-add" method="post" class="luck-from">
	<div class="group-label">
		<span class="luck-block">公司：</span>
		<select class="easyui-combobox" panelHeight="auto" data-options="required:'true',prompt:'请选择',panelHeight:'auto',url:'${ctxPath}/dm/czrgs', method:'method', valueField:'GS_ID', textField:'GS_MC',validType:'selectValueRequired[\'sel_gs\',\'该项不能为空！\']',editable:true,width:300,onChange:gsChange" id="sel_gs" name="sel_gs"></select>
	</div>
	<div class="group-label">
		<span class="luck-block">小公司：</span>
		<select class="easyui-combobox" panelHeight="auto" data-options="prompt:'请选择',panelHeight:'auto',valueField:'GSB_ID',textField:'GSB_MC',editable:true,width:300,onChange:xgsChange" id="sel_xgs" name="sel_xgs"></select>
	</div>
	<div class="group-label">
		<span class="luck-block">员工：</span>
		<select class="easyui-combobox" panelHeight="auto" data-options="prompt:'请选择',panelHeight:'auto',valueField:'RY_ID',textField:'RY_XM',editable:true,width:300" id="sel_ry" name="sel_ry"></select>
		<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="ryChoice()"></a>
	</div>
	<div class="group-label">
		<span class="luck-block">调整福利：</span>
		<input class="easyui-textbox w350" id="ipt_nr" name="ipt_nr" data-options="required:'true',missingMessage:'调整福利不能为空！',validType:'maxLen[400,\'1~400位字符，英文一个字符，中文两个字符!\']'">
	</div>
	<div class="group-label">
		<span class="luck-block">调整日期：</span>
		<input class="easyui-my97" name="tzrq" id="tzrq" data-options="required:'true',missingMessage:'调整日期不能为空！',dateFmt:'yyyy-MM-dd'">
	</div>
</form>
<script>
	function gsChange(value){
		//alert(value);
		if(value!="")//不为空
		{
			//小公司获取列表
			$("#sel_xgs").combobox("clear");
			$("#sel_xgs").combobox("reload","${ctxPath}/dm/czrxgs?gsid="+value);
			$("#sel_ry").combobox("clear");
			//员工姓名重置
		}
		else
		{
			$("#sel_xgs").combobox("clear");
			$("#sel_ry").combobox("clear");
		}
	}
	
	function xgsChange(value){
		//alert(value);
		if(value!="")//不为空
		{
			var gsid=$("#sel_gs").combobox("getValue");
			//员工姓名重新加载数据
			$("#sel_ry").combobox("reload","${ctxPath}/dm/czrry?xgsid="+value+"&gsid="+gsid);
		}
		else
		{
			$("#sel_ry").combobox("clear");
		}
	}
	
	//人员查询
	function ryChoice(){
		//获取人员combobox值
		var ry_id = $("#sel_ry").combobox("getValue");
		var ry_xm = $("#sel_ry").combobox("getText");
		//生成查询按钮id
		var btnId = "btn" + $.util.guid("N");
		//创建工具栏对象
	    	var toolbar = [
	            { type: "label", options: { text: "姓名：" } },
	            {
	                type: "textbox", options: {
	                    name: "tzxx_rycx_xm", width: 120,value:ry_xm,
	                    keydown: function (event, t) {
	                        if (event.keyCode == 13) {
	                            $(t).find("#" + btnId).click();
	                            event.preventDefault();
	                        }
	                    }
	                }
	            },
	            {
	                type: "button", options: {
	                    text: "查询", iconCls: "icon-search", id: btnId,
	                    onclick: function (t) {
	                    		//console.log(t);
	                        // 如果 datagrid 的 url 是指向后台的 url 地址，则直接写成如下代码即可完成查询；
	                        $.easyui.showSelector.helper.doSearch($(t), "SingleDataGrid");
	                    }
	                }
	            }
	    ];
		//创建分页查询列表
	    	var dia = $.easyui.showSelector.singleDatagrid({
	            title: "员工选择",
	            width: 600,
	            height: 350,
	            onEnter: function (row) {
	                $("#sel_gs").combobox("setValue",row.GS_ID);
	                $("#sel_gs").combobox("setText",row.GS_MC);
	                $("#sel_xgs").combobox("setValue",row.GSB_ID);
	                $("#sel_xgs").combobox("setText",row.GSB_MC);
	                $("#sel_ry").combobox("setValue",row.RY_ID);
	                $("#sel_ry").combobox("setText",row.RY_XM);
	            },
	            extToolbar: true,
	            selected: ry_id,
	            cls:'theme-panel-deepblue',
	            iconCls:'icon-search',
	            datagridOptions: {
	                singleSelect: true,
	                toolbar: toolbar,
	                method: "post",
	                url: "${ctxPath}/htxx/tzxx/rycx",
	                idField: 'RY_ID',
	                fitColumns:true,
	                queryParams:{"tzxx_rycx_xm":ry_xm},
	                columns: [[
	                    { field: 'RY_XM', title: '姓名', width: 80 },
	                    { field: 'GS_MC', title: '公司', width: 90 },
	                    { field: 'GSB_MC', title: '小公司', width: 150 }
	                ]],
                    pagination: true
	            }
	        });
	}
</script>